import request from '../utils/request';

const studentApi={
    selectAll() {
        return request({
            url: '/stu/getAll.do',
            method: 'get'
        })
    },
    //分页查询
    selectByPage(params) {   //params对象封装分页参数
        return request({
            url: '/stu/selectByPage.do',
            method: 'get',
            params:params
        })
    },
    // 条件查询带分页
    selectByCondition(page,pageSize,params){
        console.log("数据")
        console.log(params)
        return request({
            url:'/stu/selectByCondition.do',
            method:'post',
            params:{  //参数放在url
                currentPage:page,
                pageSize:pageSize
            },
            data:params   //参数放在请求体
        })
    }, 
    addStudent(params){
        return request({
            url:'/stu/addStuAndCj.do',
            method:'post',
            data:params
        })
    },
    deleteStudent(params){
        return request({
            url:'/stu/deleteStuAndCj.do',
            method:'delete',
            params:params
        })
    },
    //通过checkbox删除数据
    deleteChecked(data){
        return request({
            url:'/stu/deleteChecked.do',
            method:'delete',
            data
        })
    },
    updateStudent(id,data){
        return request({
            url:'/stu/updateStuAndCj.do',
            method:'put',
            params:{id},
            data
        })
    },
}
export default studentApi











